]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Bug 562604 - Close the Run Dialog when Escape is pressed
authorColin Walters <walters@src.gnome.org>
Fri, 28 Nov 2008 20:48:38 +0000 (20:48 +0000)
committerColin Walters <walters@src.gnome.org>
Fri, 28 Nov 2008 20:48:38 +0000 (20:48 +0000)
Patch from RainCT (Siegfried Gevatter).

svn path=/trunk/; revision=89

js/ui/run_dialog.js

index b3c2bb3c7f8dc8d7ded4bd015ea0cc17446eafab..25e0b91c480e7644fd5afbaaee1050547f67f501 100644 (file)
@@ -92,6 +92,7 @@ _run : function(command) {
 },
 
 show : function() {
+    let me = this;
     if (this._group.visible) // Already shown
         return false;
 
@@ -100,16 +101,14 @@ show : function() {
 
     this._group.show_all();
 
-    // TODO: Detect escape key and make it cancel the operation.
-    //       Use me.on_cancel() if it exists. Something like this:
-    // this._entry.connect('key-press-event', function(o, e) {
-    //     if (the pressed key is the escape key) {
-    //         me.hide();
-    //         me.emit('cancel');
-    //         return false;
-    //     } else
-    //         return true;
-    // });
+    this._entry.connect('key-press-event', function(o, e) {
+        if (e.get_code() == 9) {
+            me.hide();
+            me.emit('cancel');
+            return true;
+        } else
+            return false;
+    });
 
     let global = Shell.Global.get();
     global.stage.set_key_focus(this._entry);